﻿using Microsoft.AspNetCore.Mvc;
using SportsPlatform.Jwt;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SportsPlatform.PermissionManagement.IPermissionManagement;
using SportsPlatform.Base;
using SportsPlatform.Consts;
using SportsPlatform.Query.PermissionManagement.CompanyInfo;
using SportsPlatform.Dto.PermissionManagement.CompanyInfo;
using SportsPlatform.Query.PermissionManagement.CompanyTypeInfo;
using SportsPlatform.Dto.PermissionManagement.CompanyTypeInfo;
using SportsPlatform.Query.PermissionManagement.DepartmentInfo;
using SportsPlatform.Dto.PermissionManagement.DepartmentInfo;
using SportsPlatform.Query.PermissionManagement.DepartmentRole;
using SportsPlatform.Dto.PermissionManagement.DepartmentRole;
using SportsPlatform.Query.PermissionManagement.FunctionInfo;
using SportsPlatform.Dto.PermissionManagement.FunctionInfo;
using SportsPlatform.Query.PermissionManagement.OperationInfo;
using SportsPlatform.Dto.PermissionManagement.OperationInfo;
using SportsPlatform.Query.PermissionManagement.PlatformInfo;
using SportsPlatform.Dto.PermissionManagement.PlatformInfo;
using SportsPlatform.Query.PermissionManagement.RoleFunction;
using SportsPlatform.Dto.PermissionManagement.RoleFunction;
using SportsPlatform.Query.PermissionManagement.RoleInfo;
using SportsPlatform.Dto.PermissionManagement.RoleInfo;
using SportsPlatform.Query.PermissionManagement.UserInfo;
using SportsPlatform.Dto.PermissionManagement.UserInfo;
using SportsPlatform.Query.PermissionManagement.BaseQuery;
using SportsPlatform.Query.PermissionManagement.AuthorizationInfo;
using SportsPlatform.Dto.PermissionManagement.AuthorizationInfo;
using SportsPlatform.Filters;
using AllowAnonymousAttribute = Microsoft.AspNetCore.Authorization.AllowAnonymousAttribute;
using Polly.Caching;
using SportsPlatform.Enums;

namespace SportsPlatform.Controllers
{
    /// <summary>
    /// 权限管理模块
    /// </summary>

    [ActionAuthorization]
    [Route("api/[controller]/[action]")]
    public class PermissionManagementController : SportsPlatformControllerBase
    {
        private IUserInfoService _userInfoService;
        private IPlatformInfoService _platformInfoService;
        //private IdepartmentInfoService _departmentInfoService;
        //private IdepartmentRoleService _depaRoleService;
        //private IOperationInfoService _operationInfoService;
        private IFunctionInfoService _functionInfoService;
        private IRoleInfoService _roleInfoService;
        private ICompanyInfoService _companyInfoService;
        private ICompanyTypeInfoService _companyTypeInfoService;
        private IAuthorizationService _authorizationService;
        private IRoleFunctionService _roleFuncService;

        /// <summary>
        /// 构造
        /// </summary>
        /// <param name="userInfoService"></param>
        /// <param name="platformInfoService"></param>
        /// <param name="companyInfoService"></param>
        /// <param name="companyTypeInfoService"></param>
        /// <param name="authorizationService"></param>
        /// <param name="roleInfoService"></param>
        /// <param name="functionInfoService"></param>
        public PermissionManagementController(IUserInfoService userInfoService, IPlatformInfoService platformInfoService, ICompanyInfoService companyInfoService, ICompanyTypeInfoService companyTypeInfoService, IAuthorizationService authorizationService, IRoleInfoService roleInfoService, IFunctionInfoService functionInfoService, IRoleFunctionService roleFuncService)
        {
            _userInfoService = userInfoService;
            _platformInfoService = platformInfoService;
            _companyInfoService = companyInfoService;
            _companyTypeInfoService = companyTypeInfoService;
            _authorizationService = authorizationService;
            _authorizationService = authorizationService;
            _roleInfoService = roleInfoService;
            _functionInfoService = functionInfoService;
            _roleFuncService = roleFuncService;
        }



        #region 用户表操作

        /// <summary>
        /// 新增用户信息
        /// </summary>
        /// <param name="addUserInfoQuery"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultByIdDto> AddUserInfo([FromBody] AddUserInfoQuery addUserInfoQuery)
        {
            return await _userInfoService.AddUserInfo(addUserInfoQuery);
        }

        /// <summary>
        /// 获取登录信息或验证登录名是否存在
        /// </summary>
        /// <param name="getLoginUserInfoQuery"></param>
        /// <returns></returns>
        [HttpPost]
        [AllowAnonymousAttribute]
        //[Log(OperationType.Logon)]
        public async Task<ResultDto<GetLoginUserInfoDto>> GetLoginUserInfo([FromBody] GetLoginUserInfoQuery getLoginUserInfoQuery)
        {
            return await _userInfoService.GetLoginUserInfo(getLoginUserInfoQuery);
        }

        /// <summary>
        /// 获取角色对应功能列表
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultListDto<FunctionChildren>> GetFunctionChildren()
        {
            return await _userInfoService.GetFunctionChildren();
        }

        /// <summary>
        /// 用户退出登录
        /// </summary>
        /// <param name="token">token</param>
        /// <returns>ActionResult</returns>
        [HttpGet]
        [AllowAnonymousAttribute]
        [Log(OperationType.Logout)]
        public async Task<ResultDto<bool>> Logout(String token)
        {
            return await this._userInfoService.Logout(token);
        }
        /// <summary>
        /// 验证手机号是否存在
        /// </summary>
        /// <param name="verificationUserTelQuery"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<BaseResultDto> VerificationUserTel([FromBody] VerificationUserTelQuery verificationUserTelQuery)
        {
            return await _userInfoService.VerificationUserTel(verificationUserTelQuery);
        }

        /// <summary>
        /// 更改用户登录密码
        /// </summary>
        /// <param name="updateUserInfoPassWordQuery"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<BaseResultDto> UpdateUserInfoPassWord([FromBody] UpdateUserInfoPassWordQuery updateUserInfoPassWordQuery)
        {
            return await _userInfoService.UpdateUserInfoPassWord(updateUserInfoPassWordQuery);
        }

        /// <summary>
        /// 批量/单个重置用户密码
        /// </summary>
        /// <param name="resetUserInfoPasswordQuery"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<BaseResultDto> ResetUserInfoPassword([FromBody] ResetUserInfoPasswordQuery resetUserInfoPasswordQuery)
        {
            return await _userInfoService.ResetUserInfoPassword(resetUserInfoPasswordQuery);
        }

        /// <summary>
        /// 批量/单个用户信息状态更改
        /// </summary>
        /// <param name="statusChangeUserInfoQuery"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<BaseResultDto> StatusChangeUserInfo([FromBody] StatusChangeUserInfoQuery statusChangeUserInfoQuery)
        {
            return await _userInfoService.StatusChangeUserInfo(statusChangeUserInfoQuery);
        }

        /// <summary>
        /// 根据ID获取用户信息
        /// </summary>
        /// <param name="deleteOrQueryModel"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultDto<GetUserInfoDto>> GetUserInfo([FromBody] DeleteOrGetModelQuery deleteOrQueryModel)
        {
            return await _userInfoService.GetUserInfo(deleteOrQueryModel);
        }

        ///// <summary>
        ///// 根据用户ID添加是否启用标志
        ///// </summary>
        ///// <param name="isStatesModel"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<BaseResultDto> IsStatesUserInfo([FromBody] IsStatesdModel isStatesModel)
        //{
        //    return await _userInfoService.IsStatesUserInfo(isStatesModel);
        //}

        /// <summary>
        /// 根据用户ID删除用户信息
        /// </summary>
        /// <param name="deleteOrQueryModel"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<BaseResultDto> DeleteUserInfo([FromBody] DeleteOrGetModelQuery deleteOrQueryModel)
        {
            return await _userInfoService.DeleteUserInfo(deleteOrQueryModel);
        }

        /// <summary>
        /// 更新用户信息
        /// </summary>
        /// <param name="updateUserInfoQuery"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<BaseResultDto> UpdateUserInfo([FromBody] UpdateUserInfoQuery updateUserInfoQuery)
        {
            return await _userInfoService.UpdateUserInfo(updateUserInfoQuery);
        }

        /// <summary>
        /// 获取用户信息表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<PagePagingDto<GetUserInfoListPageDto>> GetUserInfoListPage([FromBody] GetUserInfoListPageQuery query)
        {
            return await _userInfoService.GetUserInfoListPage(query);
        }

        #endregion

        #region 平台信息表操作

        /// <summary>
        /// 新增平台信息表
        /// </summary>
        /// <param name="addPlatformInfoQuery"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<BaseResultDto> AddPlatformInfo([FromBody] AddPlatformInfoQuery addPlatformInfoQuery)
        {
            return await _platformInfoService.AddPlatformInfo(addPlatformInfoQuery);
        }

        ///// <summary>
        ///// 根据ID查询平台信息表
        ///// </summary>
        ///// <param name="deleteOrQueryModel"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<ResultDto<GetPlatformInfoDto>> GetPlatformInfo([FromBody] DeleteOrGetModelQuery deleteOrQueryModel)
        //{
        //    return await _platformInfoService.GetPlatformInfo(deleteOrQueryModel);
        //}

        ///// <summary>
        ///// 获取平台信息表信息List
        ///// </summary>
        ///// <param name="getPlatformInfoQuery"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<ResultListDto<GetPlatformInfoDto>> GetPlatformInfoList([FromBody] GetPlatformInfoQuery getPlatformInfoQuery)
        //{
        //    return await _platformInfoService.GetPlatformInfoList(getPlatformInfoQuery);
        //}


        ///// <summary>
        ///// 更新平台信息
        ///// </summary>
        ///// <param name="updatePlatformInfoQuery"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<BaseResultDto> UpdatePlatformInfo([FromBody] UpdatePlatformInfoQuery updatePlatformInfoQuery)
        //{
        //    return await _platformInfoService.UpdatePlatformInfo(updatePlatformInfoQuery);
        //}

        ///// <summary>
        ///// 根据ID删除平台信息
        ///// </summary>
        ///// <param name="deleteOrQueryModel"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<BaseResultDto> DeletePlatformInfo([FromBody] DeleteOrGetModelQuery deleteOrQueryModel)
        //{
        //    return await _platformInfoService.DeletePlatformInfo(deleteOrQueryModel);
        //}

        ///// <summary>
        ///// 标记平台信息表是否启用
        ///// </summary>
        ///// <param name="isStatesModel"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<BaseResultDto> IsStatesPlatformInfo([FromBody] IsStatesdModel isStatesModel)
        //{
        //    return await _platformInfoService.IsStatesPlatformInfo(isStatesModel);
        //}

        #endregion

        #region 公司信息表操作

        /// <summary>
        /// 根据ID查询公司信息
        /// </summary>
        /// <param name="deleteOrQueryModel"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultDto<GetCompanyInfoDto>> GetCompanyInfo([FromBody] DeleteOrGetModelQuery deleteOrQueryModel)
        {
            return await _companyInfoService.GetCompanyInfo(deleteOrQueryModel);
        }

        /// <summary>
        /// 分页获取公司信息列表
        /// </summary>
        /// <param name="getCompanyInfoQuery"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<PagePagingDto<GetCompanyInfoListPageDto>> GetCompanyInfoListPage([FromBody] GetCompanyInfoListPageQuery getCompanyInfoQuery)
        {
            return await _companyInfoService.GetCompanyInfoListPage(getCompanyInfoQuery);
        }

        /// <summary>
        /// 新增公司信息
        /// </summary>
        /// <param name="addCompanyInfoQuery"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultDto<AddCompanyInfoDto>> AddCompanyInfo([FromBody] AddCompanyInfoQuery addCompanyInfoQuery)
        {
            return await _companyInfoService.AddCompanyInfo(addCompanyInfoQuery);
        }

        /// <summary>
        /// 更新公司信息
        /// </summary>
        /// <param name="updateCompanyInfoQuery"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<BaseResultDto> UpdateCompanyInfo([FromBody] UpdateCompanyInfoQuery updateCompanyInfoQuery)
        {
            return await _companyInfoService.UpdateCompanyInfo(updateCompanyInfoQuery);
        }

        /// <summary>
        /// 续期
        /// </summary>
        /// <param name="companyRenewalQuery"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<BaseResultDto> CompanyRenewal([FromBody] CompanyRenewalQuery companyRenewalQuery)
        {
            return await _companyInfoService.CompanyRenewal(companyRenewalQuery);
        }

        ///// <summary>
        ///// 根据ID删除公司信息
        ///// </summary>
        ///// <param name="deleteOrQueryModel"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<BaseResultDto> DeleteCompanyInfo([FromBody] DeleteOrGetModelQuery deleteOrQueryModel)
        //{
        //    return await _companyInfoService.DeleteCompanyInfo(deleteOrQueryModel);
        //}

        /// <summary>
        /// 标记是否启用公司信息
        /// </summary>
        /// <param name="isStatesModel"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<BaseResultDto> IsStatesCompanyInfo([FromBody] IsStatesdModel isStatesModel)
        {
            return await _companyInfoService.IsStatesCompanyInfo(isStatesModel);
        }

        /// <summary>
        /// 获取商户名称集合
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultListDto<GetCompanyNameListDto>> GetCompanyNameList()
        {
            return await _companyInfoService.GetCompanyNameList();
        }

        #endregion

        #region 公司类型信息表操作

        /// <summary>
        /// 新增公司类型信息表
        /// </summary>
        /// <param name="addCompanyTypeInfoQuery"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<BaseResultDto> AddCompanyTypeInfo([FromBody] AddCompanyTypeInfoQuery addCompanyTypeInfoQuery)
        {
            return await _companyTypeInfoService.AddCompanyTypeInfo(addCompanyTypeInfoQuery);
        }

        ///// <summary>
        ///// 根据ID查询公司类型信息表
        ///// </summary>
        ///// <param name="deleteOrQueryModel"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<ResultDto<GetCompanyTypeInfoDto>> GetCompanyTypeInfo([FromBody] DeleteOrGetModelQuery deleteOrQueryModel)
        //{
        //    return await _companyTypeInfoService.GetCompanyTypeInfo(deleteOrQueryModel);
        //}

        /// <summary>
        /// 获取公司类型信息表信息List
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultListDto<GetCompanyTypeInfoDto>> GetCompanyTypeInfoList()
        {
            return await _companyTypeInfoService.GetCompanyTypeInfoList();
        }


        ///// <summary>
        ///// 更新公司类型信息
        ///// </summary>
        ///// <param name="updateCompanyTypeInfoQuery"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<BaseResultDto> UpdateCompanyTypeInfo([FromBody] UpdateCompanyTypeInfoQuery updateCompanyTypeInfoQuery)
        //{
        //    return await _companyTypeInfoService.UpdateCompanyTypeInfo(updateCompanyTypeInfoQuery);
        //}

        ///// <summary>
        ///// 根据ID删除公司类型信息
        ///// </summary>
        ///// <param name="deleteOrQueryModel"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<BaseResultDto> DeleteCompanyTypeInfo([FromBody] DeleteOrGetModelQuery deleteOrQueryModel)
        //{
        //    return await _companyTypeInfoService.DeleteCompanyTypeInfo(deleteOrQueryModel);
        //}

        ///// <summary>
        ///// 标记公司类型信息表是否启用
        ///// </summary>
        ///// <param name="isStatesModel"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<BaseResultDto> IsStatesCompanyTypeInfo([FromBody] IsStatesdModel isStatesModel)
        //{
        //    return await _companyTypeInfoService.IsStatesCompanyTypeInfo(isStatesModel);
        //}

        #endregion

        #region 授权信息表操作
        /// <summary>
        /// 新增客户信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<BaseResultDto> AddAuthorizationInfo([FromBody] AddAuthorizationInfoQuery query)
        {
            return await _authorizationService.AddAuthorizationInfo(query);
        }

        /// <summary>
        /// 获取用户授权状态
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultDto<GetUserAuthorizationDto>> GetUserAuthorization([FromBody] GetUserAuthorizationQuery query)
        {
            return await _authorizationService.GetUserAuthorization(query);
        }

        /// <summary>
        /// 获取用户授权文件
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultDto<GetUserAuthorizationFileDto>> GetUserAuthorizationFile([FromBody] GetUserAuthorizationFileQuery query)
        {
            return await _authorizationService.GetUserAuthorizationFile(query);
        }

        /// <summary>
        /// 批量/单个审核
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<BaseResultDto> AuthorizationSteats([FromBody] StatusChangeAuthorizationInfoQuery query)
        {
            return await _authorizationService.AuthorizationSteats(query);
        }

        ///// <summary>
        ///// 获取授权列表信息
        ///// </summary>
        ///// <param name="query"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<PagePagingDto<GetAuthorizationInfoListDto>> GetAuthorizationList([FromBody] GetAuthorizationInfoQuery query)
        //{
        //    return await _authorizationService.GetAuthorizationList(query);
        //}

        /// <summary>
        /// 获取授权详细列表信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<PagePagingDto<GetAuthorizationDetailedInfoListDto>> GetAuthorizationDetailedInfoList([FromBody] GetAuthorizationInfoQuery query)
        {
            return await _authorizationService.GetAuthorizationDetailedInfoList(query);
        }

        /// <summary>
        /// 获取授权商户信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultDto<GetAuthorizationCompanyInfoDto>> GetAuthorizationCompanyInfo([FromBody] GetAuthorizationCompanyInfoQuery query)
        {
            return await _authorizationService.GetAuthorizationCompanyInfo(query);
        }

        /// <summary>
        /// 获取授权码
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultDto<GetAuthorizationCodeDto>> GetAuthorizationCode([FromBody] GetAuthorizationCodeQuery query)
        {
            return await _authorizationService.GetAuthorizationCode(query);
        }

        /// <summary>
        /// 商户授权验证密码
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<BaseResultDto> AuthorizationVerificationPassword([FromBody] AuthorizationVerificationPasswordQuery query)
        {
            return await _authorizationService.AuthorizationVerificationPassword(query);
        }
        #endregion

        #region 功能操作信息表操作

        ///// <summary>
        ///// 根据ID查询功能操作信息
        ///// </summary>
        ///// <param name="deleteOrQueryModel"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<ResultDto<GetOperationInfoDto>> GetOperationInfo([FromBody] DeleteOrGetModelQuery deleteOrQueryModel)
        //{
        //    return await _operationInfoService.GetOperationInfo(deleteOrQueryModel);
        //}

        ///// <summary>
        ///// 获取功能操作信息List
        ///// </summary>
        ///// <param name="getOperationInfoQuery"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<ResultListDto<GetOperationInfoDto>> GetOperationInfoList([FromBody] GetOperationInfoQuery getOperationInfoQuery)
        //{
        //    return await _operationInfoService.GetOperationInfoList(getOperationInfoQuery);
        //}

        ///// <summary>
        ///// 新增功能操作信息
        ///// </summary>
        ///// <param name="addOperationInfoQuery"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<BaseResultDto> AddOperationInfo([FromBody] AddOperationInfoQuery addOperationInfoQuery)
        //{
        //    return await _operationInfoService.AddOperationInfo(addOperationInfoQuery);
        //}

        ///// <summary>
        ///// 更新功能操作信息
        ///// </summary>
        ///// <param name="updateOperationInfoQuery"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<BaseResultDto> UpdateOperationInfo([FromBody] UpdateOperationInfoQuery updateOperationInfoQuery)
        //{
        //    return await _operationInfoService.UpdateOperationInfo(updateOperationInfoQuery);
        //}

        ///// <summary>
        ///// 根据ID删除功能操作信息
        ///// </summary>
        ///// <param name="deleteOrQueryModel"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<BaseResultDto> DeleteOperationInfo([FromBody] DeleteOrGetModelQuery deleteOrQueryModel)
        //{
        //    return await _operationInfoService.DeleteOperationInfo(deleteOrQueryModel);
        //}

        ///// <summary>
        ///// 标记是否启用功能操作信息
        ///// </summary>
        ///// <param name="isStatesModel"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<BaseResultDto> IsStatesOperationInfo([FromBody] IsStatesdModel isStatesModel)
        //{
        //    return await _operationInfoService.IsStatesOperationInfo(isStatesModel);
        //}

        #endregion

        #region 功能信息表操作

        /// <summary>
        /// 根据Id查询信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultDto<GetFunctionInfoDto>> GetFunctionInfo([FromBody] DeleteOrGetModelQuery query)
        {
            return await _functionInfoService.GetFunctionInfo(query);
        }

        /// <summary>
        /// 分页获取信息List
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<PagePagingDto<GetFunctionInfoDto>> GetFunctionInfoList([FromBody] GetFunctionInfoQuery query)
        {
            return await _functionInfoService.GetFunctionInfoList(query);
        }

        /// <summary>
        /// 分页获取所有的下级List
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultListDto<GetFunctionInfoTreeDto>> GetFunctionInfoChildList([FromBody] GetFunctionInfoTreeQuery query)
        {
            return await _functionInfoService.GetFunctionInfoChildList(query);
        }

        /// <summary>
        /// 新增信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<BaseResultDto> AddFunctionInfo([FromBody] AddFunctionInfoQuery query)
        {
            return await _functionInfoService.AddFunctionInfo(query);
        }

        /// <summary>
        /// 更新信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<BaseResultDto> UpdateFunctionInfo([FromBody] UpdateFunctionInfoQuery query)
        {
            return await _functionInfoService.UpdateFunctionInfo(query);
        }

        /// <summary>
        /// 根据Id删除信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]

        public async Task<BaseResultDto> DeleteFunctionInfo([FromBody] DeleteOrGetModelQuery query)
        {
            return await _functionInfoService.DeleteFunctionInfo(query);
        }

        /// <summary>
        /// 批量/单个修改状态
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]

        public async Task<BaseResultDto> FunctionInfoBatchChangeOfStatus([FromBody] FunctionInfoBatchChangeOfStatusQuery query)
        {
            return await _functionInfoService.FunctionInfoBatchChangeOfStatus(query);
        }

        #endregion

        #region 部门信息架构表操作

        ///// <summary>
        ///// 新增部门信息
        ///// </summary>
        ///// <param name="addDepartmentInfoQuery"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<BaseResultDto> AddDepartmentInfo([FromBody] AddDepartmentInfoQuery addDepartmentInfoQuery)
        //{
        //    return await _departmentInfoService.AddDepartmentInfo(addDepartmentInfoQuery);
        //}

        ///// <summary>
        ///// 获取部门信息所有上级树状List
        ///// </summary>
        ///// <param name="getDepartmentInfoTreeQuery"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<ResultListDto<GetDepartmentInfoTreeDto>> GetDepartmentInfoParentList([FromBody] GetDepartmentInfoTreeQuery getDepartmentInfoTreeQuery)
        //{
        //    return await _departmentInfoService.GetDepartmentInfoParentList(getDepartmentInfoTreeQuery);
        //}

        ///// <summary>
        ///// 获取部门信息所有下级树状List
        ///// </summary>
        ///// <param name="getDepartmentInfoTreeQuery"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<ResultListDto<GetDepartmentInfoTreeDto>> GetDepartmentInfoChildList([FromBody] GetDepartmentInfoTreeQuery getDepartmentInfoTreeQuery)
        //{
        //    return await _departmentInfoService.GetDepartmentInfoChildList(getDepartmentInfoTreeQuery);
        //}

        ///// <summary>
        ///// 根据ID查询部门信息
        ///// </summary>
        ///// <param name="deleteOrQueryModel"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<ResultDto<GetDepartmentInfoDto>> GetDepartmentInfo([FromBody] DeleteOrGetModelQuery deleteOrQueryModel)
        //{
        //    return await _departmentInfoService.GetDepartmentInfo(deleteOrQueryModel);
        //}

        ///// <summary>
        ///// 获取部门信息List
        ///// </summary>
        ///// <param name="getDepartmentInfoQuery"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<ResultListDto<GetDepartmentInfoDto>> GetDepartmentInfoList([FromBody] GetDepartmentInfoQuery getDepartmentInfoQuery)
        //{
        //    return await _departmentInfoService.GetDepartmentInfoList(getDepartmentInfoQuery);
        //}

        ///// <summary>
        ///// 更新部门信息
        ///// </summary>
        ///// <param name="updateDepartmentInfoQuery"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<BaseResultDto> UpdateDepartmentInfo([FromBody] UpdateDepartmentInfoQuery updateDepartmentInfoQuery)
        //{
        //    return await _departmentInfoService.UpdateDepartmentInfo(updateDepartmentInfoQuery);
        //}

        ///// <summary>
        ///// 根据ID删除部门信息
        ///// </summary>
        ///// <param name="deleteOrQueryModel"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<BaseResultDto> DeleteDepartmentInfo([FromBody] DeleteOrGetModelQuery deleteOrQueryModel)
        //{
        //    return await _departmentInfoService.DeleteDepartmentInfo(deleteOrQueryModel);
        //}

        ///// <summary>
        ///// 标记是否启用部门信息
        ///// </summary>
        ///// <param name="isStatesModel"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<BaseResultDto> IsStatesDepartmentInfo([FromBody] IsStatesdModel isStatesModel)
        //{
        //    return await _departmentInfoService.IsStatesDepartmentInfo(isStatesModel);
        //}

        #endregion

        #region 角色信息表操作

        /// <summary>
        /// 根据Id查询角色信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]

        public async Task<ResultDto<GetRoleInfoDto>> GetRoleInfo([FromBody] DeleteOrGetModelQuery query)
        {
            return await _roleInfoService.GetRoleInfo(query);
        }

        /// <summary>
        /// 分页获取角色信息列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]

        public async Task<PagePagingDto<GetRoleInfoPageDto>> GetRoleInfoPage([FromBody] GetRoleInfoPageQuery query)
        {
            return await _roleInfoService.GetRoleInfoPage(query);
        }

        /// <summary>
        /// 获取角色名称集合
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]

        public async Task<ResultListDto<GetRoleNameListDto>> GetRoleNameList([FromBody] GetRoleNameListQuery query)
        {
            return await _roleInfoService.GetRoleNameList(query);
        }

        /// <summary>
        /// 新增角色信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]

        public async Task<BaseResultDto> AddRoleInfo([FromBody] AddRoleInfoQuery query)
        {
            return await _roleInfoService.AddRoleInfo(query);
        }

        /// <summary>
        /// 更新角色信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]

        public async Task<BaseResultDto> UpdateRoleInfo([FromBody] UpdateRoleInfoQuery query)
        {
            return await _roleInfoService.UpdateRoleInfo(query);
        }

        /// <summary>
        /// 根据Id删除角色信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]

        public async Task<BaseResultDto> DeleteRoleInfo([FromBody] DeleteOrGetModelQuery query)
        {
            return await _roleInfoService.DeleteRoleInfo(query);
        }

        /// <summary>
        /// 批量/单个更改角色状态
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]

        public async Task<BaseResultDto> RoleInfoBatchChangeOfStatus([FromBody] RoleInfoBatchChangeOfStatusQuery query)
        {
            return await _roleInfoService.RoleInfoBatchChangeOfStatus(query);
        }
        #endregion

        #region 角色功能对应表操作

        /// <summary>
        /// 获取功能菜单，只能获取自己已有的权限菜单
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]

        public async Task<PagePagingDto<GetRoleFunctionDto>> GetRoleFunctionList([FromBody] GetRoleFunctionQuery query)
        {
            return await _roleFuncService.GetRoleFunctionList(query);
        }


        /// <summary>
        ///  获取树型功能菜单，只能获取自己已有的权限树型菜单
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultListDto<GetRoleFunctionTreeListDto>> GetRoleFunctionTreeList([FromBody] GetRoleFunctionTreeListQuery query)
        {
            return await _roleFuncService.GetRoleFunctionTreeList(query);
        }
        /// <summary>
        /// 新增或者更新
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]

        public async Task<BaseResultDto> AddOrUpdateRoleFunction([FromBody] AddOrUpdateRoleFunctionQuery query)
        {
            return await _roleFuncService.AddOrUpdateRoleFunction(query);
        }

        /// <summary>
        /// 获取功能菜单编号
        /// </summary>
        /// <returns></returns>
        [HttpPost]

        public async Task<ResultListDto<GetFunctionNumberDto>> GetFunctionNumberList()
        {
            return await _roleFuncService.GetFunctionNumberList();
        }
        #endregion

        #region 部门角色对应表操作

        ///// <summary>
        ///// 根据ID查询部门角色对应信息
        ///// </summary>
        ///// <param name="deleteOrQueryModel"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<ResultDto<GetDepartmentRoleDto>> GetDepartmentRole([FromBody] DeleteOrGetModelQuery deleteOrQueryModel)
        //{
        //    return await _depaRoleService.GetDepartmentRole(deleteOrQueryModel);
        //}

        ///// <summary>
        ///// 获取部门角色对应信息List
        ///// </summary>
        ///// <param name="getDepartmentRoleQuery"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<ResultListDto<GetDepartmentRoleDto>> GetDepartmentRoleList([FromBody] GetDepartmentRoleQuery getDepartmentRoleQuery)
        //{
        //    return await _depaRoleService.GetDepartmentRoleList(getDepartmentRoleQuery);
        //}

        ///// <summary>
        ///// 新增部门角色对应信息
        ///// </summary>
        ///// <param name="addDepartmentRoleQuery"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<BaseResultDto> AddDepartmentRole([FromBody] AddDepartmentRoleQuery addDepartmentRoleQuery)
        //{
        //    return await _depaRoleService.AddDepartmentRole(addDepartmentRoleQuery);
        //}

        ///// <summary>
        ///// 更新部门角色对应信息
        ///// </summary>
        ///// <param name="updateDepartmentRoleQuery"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<BaseResultDto> UpdateDepartmentRole([FromBody] UpdateDepartmentRoleQuery updateDepartmentRoleQuery)
        //{
        //    return await _depaRoleService.UpdateDepartmentRole(updateDepartmentRoleQuery);
        //}

        ///// <summary>
        ///// 根据ID删除部门角色对应信息
        ///// </summary>
        ///// <param name="deleteOrQueryModel"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<BaseResultDto> DeleteDepartmentRole([FromBody] DeleteOrGetModelQuery deleteOrQueryModel)
        //{
        //    return await _depaRoleService.DeleteDepartmentRole(deleteOrQueryModel);
        //}

        ///// <summary>
        ///// 标记是否启用部门角色对应信息
        ///// </summary>
        ///// <param name="isStatesModel"></param>
        ///// <returns></returns>
        //[HttpPost]
        //public async Task<BaseResultDto> IsStatesDepartmentRole([FromBody] IsStatesdModel isStatesModel)
        //{
        //    return await _depaRoleService.IsStatesDepartmentRole(isStatesModel);
        //}

        #endregion
    }
}
